#ifndef SERIALPORT_H
#define SERIALPORT_H

#include <QObject>
#include <QSerialPort>
#include <QSerialPortInfo>

class serialport : public QObject
{
    Q_OBJECT
public:
    explicit serialport(QObject *parent = nullptr);

public:

signals:
    void getSerialPortMsg(QByteArray msg);
    void start_timing(void);
    void stop_timing(void);
private slots:
    void RecvPortMsg(void);
public slots:
    void serialPortInit(QString name, QString baudrate);
    QStringList getVaildSerialPortName(void);
    void serialWriteData(const char *data);
    void serialClose(void);
    void setSerialPortNameAndBaudrate(QString name, QString baud);
    char isSerialOpen(void);
private:
    QSerialPort *m_serialPort;
    char isOpen;
};

#endif // SERIALPORT_H
